from selenium import webdriver
import time

driver = webdriver.Chrome(r'E:\chromedriver_win32 存放目录\chromedriver.exe')
driver.get("https://www.csdn.net/")
time.sleep(3)

for i in range(3):
    driver.execute_script("window.scrollTo(0,document.body.scrollHeight); var lenOfPage=document.body.scrollHeight;return lenOfPage")
    # driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
    time.sleep(1)

driver.quit()